//
//  TwoLabelCell.m
//  QuXiang
//
//  Created by Duncan on 2020/7/1.
//  Copyright © 2020 NanHuaiZi. All rights reserved.
//

#import "TwoLabelCell.h"

@implementation TwoLabelCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.clipsToBounds = YES;
        [self.contentView addSubviews:[NSArray arrayWithObjects:self.leftLabel, self.rightLabel, nil]];
        [self masonryLayout];
    }
    return self;
}


#pragma mark ------- Lazy Methods -------

- (void)masonryLayout {
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView.mas_left).offset(kFragmemtFloat(15));
    }];
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right).offset(-kFragmemtFloat(15));
        make.centerY.equalTo(self.contentView);
    }];
}

- (UILabel *)leftLabel {
    if (!_leftLabel) {
        _leftLabel = [UILabel initWithTextColor:[UIColor blackColor] fontSize:15];
    }
    return _leftLabel;
}

- (UILabel *)rightLabel {
    if (!_rightLabel) {
        _rightLabel = [UILabel initWithTextColor:k_Color_TipColor fontSize:15];
        _rightLabel.textAlignment = NSTextAlignmentRight;
    }
    return _rightLabel;
}

@end
